import Vue from 'vue'
import Router from 'vue-router'
import Index from '../components/Index/index'
import Questions from '../components/Questions/questions'
import Datas from '../components/Datas/datas'
import User from '../components/User/user'
import LoginUser from '../components/LoginUser/loginUser'
import FindPassword from '../components/FindPassword/findPassword'
import tip from '../components/tip/tip';
import answerIndex from '../components/answerIndex/answerIndex';

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/home',
      component: Index
    },
    {
      path: '/data',
      component: Datas
    },
    {
      // 登录
      path: '/user',
      component: User
    },
    {
      path: '/loginUser',
      component: LoginUser
      // meta: {
      //   requireAuth: true // 添加该字段，表示进入这个路由是需要登录的
      // }
    },
    {
      path: '/questions/:key',
      component: Questions,
      children: [
        // 用户答题或者在线学习组件
        {
          path: 'answer/:key',
          component: answerIndex
        }
      ]
    },
    {
      path: '/find',
      component: FindPassword
    },
    {
      path: '/',
      redirect: '/user'
    },
    {
      path: '/tip',
      component: tip
    }
  ]
})
